{{Extend "layout"}}
{{Block "title"}}{{"订单管理"|T}}{{/Block}}
{{Block "breadcrumb"}}
{{Super}}
<li class="active">{{"订单管理"|T}}</li>
{{/Block}}
{{Block "main"}}
<div class="row">
	<div class="col-md-12">
		<div class="block-flat">
			<div class="header">
				<div class="pull-right" style="margin-left:10px">
					<form class="form-horizontal" action="" id="search-form" method="GET">
						<div class="input-group">
							<span class="input-group-addon">{{"状态"|T}}</span>
							<select name="status" class="form-control" id="status" onchange="$('#search-form').submit()">
								<option value=""> - {{"不限"|T}} - </option>
								{{$status := Form "status"}} 
								{{range $k, $v := Stored.statusList}}
								<option value="{{$v.K}}" {{if eq $status $v.K}} selected{{end}}>{{$v.V}}</option>
								{{end}}
							</select>
						</div>
					</form>
				</div>
				<a href="__BACKEND__/official/pay/order_add" class="btn btn-success pull-right">
					<i class="fa fa-plus"></i>
					{{"添加订单"|T}}
				</a>							
				<h3>{{"订单列表"|T}}</h3>
			</div>
			<div class="content">
				<div class="table-responsive">
				<table class="table no-border hover">
					<thead class="no-border">
						<tr>
							<th style="width:2%;"><strong>ID</strong></th>
							<th><strong>{{"标题"|T}}</strong></th>
							<th style="width:60px"><strong>{{"价格"|T}}</strong></th>
							<th style="width:60px"><strong>{{"实付价"|T}}</strong></th>
							<th style="width:70px"><strong>{{"支付方式"|T}}</strong></th>
							<th style="width:150px"><strong>{{"外部单号"|T}}</strong></th>
							<th style="width:170px"><strong>{{"付款时间"|T}}</strong></th>
							<th style="width:70px"><strong>{{"付款码ID"|T}}</strong></th>
							<th style="width:70px"><strong>{{"状态"|T}}</strong></th>
							<th style="width:170px"><strong>{{"时间"|T}}</strong></th>
							<th style="width:120px" class="text-center"><strong>{{"操作"|T}}</strong></th>
						</tr>
					</thead>
					<tbody class="no-border-y">
                        {{range $k,$v := Stored.listData}}
						<tr>
							<td>{{$v.Id}}</td>
							<td>{{$v.Title}}</td>
							<td>{{$v.Price}}</td>
							<td>{{$v.RealPrice}}</td>
							<td>{{$v.Type}}</td>
							<td>{{$v.OutOrderId}}</td>
							<td>{{if gt $v.PaidAt 0}}{{(Date $v.PaidAt).Format "2006-01-02 15:04:05"}}{{else}}{{"未付款"|T}}{{end}}</td>
							<td>{{$v.QrcodeId}}</td>
							<td>
								{{- if eq $v.Status "inprogress" -}}
								<a href="{{$v.CheckoutURL}}" target="_blank"><span class="badge badge-default">{{"未支付"|T}}</span></a>
								{{- else if eq $v.Status "expired" -}}
								<span class="badge badge-warning">{{"已过期"|T}}</span>
								{{- else if eq $v.Status "paid" -}}
								<span class="badge badge-primary">{{"已付款,未通知"|T}}</span>
								{{- else if eq $v.Status "unsettled" -}}
								<span class="badge badge-danger">{{"通知失败"|T}}</span>
								{{- else if eq $v.Status "settled" -}}
								<span class="badge badge-success">{{"已完成"|T}}</span>
								{{- end -}}
							</td>
							<td>
								{{"创建"|T}}:{{- (Date $v.Created).Format "2006-01-02 15:04:05" -}}
								<br/>
								{{- if gt $v.Updated 0 -}}
								{{"修改"|T}}:{{(Date $v.Updated).Format "2006-01-02 15:04:05"}}
								{{- end -}}
								{{- if gt $v.Expired 0 -}}
								{{"过期"|T}}:{{(Date $v.Expired).Format "2006-01-02 15:04:05"}}
								{{- end -}}</td>
							<td class="text-center">
							<a class="label label-default" href="__BACKEND__/official/pay/order_add?copyId={{$v.Id}}" title="{{"复制"|T}}" data-toggle="tooltip"><i class="fa fa-copy"></i></a>
							<a class="label label-success" href="__BACKEND__/official/pay/order_edit?id={{$v.Id}}" title="{{"编辑"|T}}" data-toggle="tooltip"><i class="fa fa-pencil"></i></a> 
							<a class="label label-danger" href="__BACKEND__/official/pay/order_delete?id={{$v.Id}}" onclick="return confirm('{{"真的要删除吗？"|T}}');" title="{{"删除"|T}}" data-toggle="tooltip"><i class="fa fa-times"></i></a>
							</td>
						</tr>
                        {{end}}
					</tbody>
				</table>
				</div>
				{{Stored.pagination.Render}}
			</div>
		</div>				
	</div>
</div>
{{/Block}}